home *** CD-ROM | disk | FTP | other *** search
/ Utilities Professional 1-1500 / Utilities Professional 1-1500 (1994)(WPD)[!].iso / 12511500 / var1307.dms / var1307.adf / BMS_REPO.REX < prev    next >
OS/2 REXX Batch file  |  1992-09-02  |  3KB  |  107 lines

  1. /*
  2.  * quick bms status report.
  3.  */
  4.  
  5. /* Initialize */
  6. address command
  7. moves. = 0
  8. hosts. = 0
  9. files. = 0
  10. hostcount = 0
  11. filecount = 0
  12. progressing = 0
  13. repout = 't:bms-repout'
  14.  
  15. /* Get the raw data */
  16. 'bms >'repout  'status active'
  17. if ~open(repout, repout, 'Read') then do
  18.     say "Can't create intermediate report file"
  19.     exit 20
  20.     end
  21.  
  22.  
  23. /* Scan the lines, getting stats */
  24. do while ~eof(repout)
  25.     line = readln(repout)
  26.     if line = "" then iterate
  27.     select
  28.         when index(line, 'flags=') > 0 then do
  29.             if index(line, '100%') = 0 | index(line, 'NOTFND') > 0 then 
  30.                 iterate        /* Skip incompletes and failures */
  31.             if direction = in then
  32.                 parse upper var line 'REM=' file .
  33.             else
  34.                 parse upper var line . . file .
  35.             if ~files.file then do
  36.                 filecount = filecount + 1
  37.                 files.filecount = file
  38.                 files.file = 1
  39.                 end
  40.             if ~hosts.host then do
  41.                 hostcount = hostcount + 1
  42.                 hosts.hostcount = host
  43.                 hosts.host = 1
  44.                 end
  45.             moves.direction.host.file = moves.direction.host.file + 1
  46.             moves.direction.host = moves.direction.host + 1
  47.             moves.direction.file = moves.direction.file + 1
  48.             end
  49.         when index(line, ':OUTGOING-DONE-WAIT') > 0 then
  50.             direction = out
  51.         when index(line, ':RXDONE-WAIT') > 0 then
  52.             direction = in
  53.         when index(line, 'REGISTRATION') > 0 then
  54.             parse var line . 'ALIAS=' host .
  55.         when index(line, ':GET-REQ-SENT') > 0 | index(line, ':RECEIVE') > 0 then
  56.             progressing = progressing + 1    /* ignore things in progress */
  57.         otherwise say "Possibly unkown line" i":"line
  58.         end
  59.     end
  60. call close repout
  61.  
  62. /* Print the stats: incoming */
  63. direction = in
  64. do i = 1 to hostcount
  65.     host = hosts.i
  66.     if moves.direction.host > 0 then do
  67.         say "You have gotten" moves.direction.host "file(s) from" host":"
  68.         do j = 1 to filecount
  69.             file = files.j
  70.             if moves.direction.host.file ~= 0 then
  71.                 say "    "file moves.direction.host.file "time(s)."
  72.             end
  73.         end
  74.     end
  75. say ""
  76.  
  77. /* Outgoing */
  78. direction = out
  79. do i = 1 to hostcount
  80.     host = hosts.i
  81.     if moves.direction.host > 0 then do
  82.         say host "has gotten" moves.direction.host "file(s) from you:"
  83.         do j = 1 to filecount
  84.             file = files.j
  85.             if moves.direction.host.file ~= 0 then
  86.                 say "    "file moves.direction.host.file "time(s)."
  87.             end
  88.         end
  89.     end
  90. say ""
  91.  
  92. /* Outbound count */
  93. do i = 1 to filecount
  94.     file = files.i
  95.     if moves.direction.file > 0 then
  96.         say file "has been gotten" moves.direction.file "time(s)."
  97.     end
  98.  
  99. /* In progress */
  100. if progressing > 0 then do
  101.     say ""
  102.     say progressing "tranfer(s) in progress."
  103.     end
  104.  
  105. /* Clean up */
  106. 'delete quiet force' repout
  107.